package stanford.com.balldating.chat;

import org.json.JSONObject;

import java.io.Serializable;

/**
 * 聊天消息实体类
 * @author daobo.yuan
 */
public class ChatMessage implements Serializable{
	public String from;
	public String to;
	public String msg;
	public ChatMessage() {
		super();
	}
	public ChatMessage(JSONObject json){
		try {
			from = json.getString("from");
			to = json.getString("to");
			msg = json.getString("msg");
		}catch (Exception e){}
	}

	public JSONObject toJSONObject(){
		JSONObject json=new JSONObject();
		try {
			json.put("from", from);
			json.put("to", to);
			json.put("msg", msg);
		}catch (Exception e){}
		return json;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	public void setTo(String to) {
		this.to = to;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String getFrom() {
		return from;
	}

	public String getTo() {
		return to;
	}

	public String getMsg() {
		return msg;
	}
}